﻿using Microsoft.AspNetCore.Mvc;

namespace TestApi.Controllers;

/// <summary>
/// 测试Post 参数示例
/// </summary>
[ApiController,Route("api/[controller]"),ApiExplorerSettings(GroupName = "v1")]
public class PostTestController : Controller
{
    [HttpPost("object/null")]
    public IActionResult PostObjectNull()
    {
        return Ok("Success");
    }
    
    [HttpPost("object/string")]
    public IActionResult PostObjectString([FromBody]string str)
    {
        return Ok("Success");
    }
    
    [HttpPost("object/long")]
    public IActionResult PostObjectLong([FromBody]long ids)
    {
        return Ok("Success");
    }
    
    [HttpPost("object/list/int")]
    public IActionResult PostObjectList([FromBody]List<int> array)
    {
        return Ok("Success");
    }
    
    [HttpPost("object/list/string")]
    public IActionResult PostObjectList([FromBody]List<string> array)
    {
        return Ok("Success");
    }
    
    [HttpPost("object/class")]
    public IActionResult PostObjectClass([FromBody]WeatherForecastController.MyClass objects)
    {
        return Ok("Success");
    }
    
    [HttpPost("object/array")]
    public IActionResult PostObjectClass([FromBody]List<WeatherForecastController.MyClass> objects)
    {
        return Ok("Success");
    }
}